#include<bits/stdc++.h>
using namespace std;
int main()
{
    vector<int> arr;
    arr.push_back(2);
    arr.push_back(4);
    arr.push_back(7);
    arr.push_back(6);
    arr.push_back(3);
    arr.push_back(1);
    for(auto left = arr.begin(),right = arr.end()-1;left != right;)
    {
        if(!(*left&1)&&(*right&1))
        {
            int temp = *left;
            *left = *right;*right = temp;
        }
        else if(*right&1)
            left++;
        else
            right--;
    }
    for(auto &ele:arr)
        cout << ele << ' ';
    return 0;
}